Answer:

When it runs it will print out:

-2
-1
0
1
The first number printed is "-2" because COUNT was started out at -2 and -2 < 2 is true. Then COUNT is changed to -1 and LOOP sends execution back to the DO WHILE. Since -1 < 2 is true, "-1" is printed. And so on.

Other Number Comparisons

So far you have seen two tests: less than or equal and less than. QBasic can do more than that. Here is a complete list:

Table of Relational Symbols
SymbolExampleMeaning
= A = B   is A equal to B ?
< A < B   is A less than B ?
<= A <= B   is A less than or equal to B ?
> A > B   is A Greater than B ?
>= A >= B   is A Greater than or equal to B ?
<> A <> B   is A different than B ?

These mean what they do in arithmetic. For example:

relationresult relationresult
25 = 25 true  25 < 25false
25 <= 25 true  25 > 25false
25 >= 25 true  25 <> 25false

Each one of these tests, such as 25 < 25 is called a relational expression. A relational expression tests the relationship between two numbers and says if the relationship is "true" or "false."

relation result  relationresult  relation result  relationresult
15 = 25 false  15 < 25true   15 = 5 false  15 < 5false
15 <= 25 true  15 > 25false   15 <= 5 false  15 > 5true
15 >= 25 false  15 <> 25true   15 >= 5 true  15 <> 5true

 

QUESTION 6:

Decide on TRUE or FALSE for each of the following:

comparison true false
17 = 17    
17 < 15    
17 <= 15    
12 > 12    
12 >= 12    
12 <> 17